#include<iostream>
#include<assert.h> 
using namespace std;
struct SeqList
{
	int* a;
	int size;
	int capacity;
    

	void SLInit()
	{
		a = (int*)malloc(sizeof(int) * 4);
		size = 0;
		capacity = 4;
	}
	//插入
	void SLPushBack(int x)
	{
		//...扩容
		a[size++] = x;
	}
//修改
	void SLModity(int pos, int x)
	{
		assert(pos >= 0);
		assert(pos < size);
		a[pos] = x;
	}
//获取
	int& SLGet(int pos)
	{
		assert(pos >= 0);
		assert(pos < size);
		return a[pos];
	}
	int& operator[](int pos)
	{
		assert(pos >= 0);
		assert(pos < size);

		return a[pos];
	}
};

int main()
{
	SeqList s;
	s.SLInit();
	s.SLPushBack(1);
	s.SLPushBack(2);
	s.SLPushBack(3);
	s.SLPushBack(4);
	s.SLPushBack(5);
	s.SLPushBack(6);
	s.SLPushBack(7);
	for (int i = 0; i < s.size; i++)
	{
		cout << s.SLGet(i) << " ";
		//cout << s[i] << " ";
		//cout << s.operator[](i) << " ";
	}
	cout << endl;

	for (int i = 0; i < s.size; i++)
	{
		if (s.SLGet(i) % 2 == 0)
		{
			//s.SLGet(i) *= 2;
			s.SLModity(i, s.SLGet(i) * 2);
		}
	}
	cout << endl;
	
	for (int i = 0; i < s.size; i++)
	{
		cout << s.SLGet(i) << " ";
	}
	cout << endl;

	return 0;
}